package fields;

import view.Boundary;

public class Street extends Ownable{
	private int houseCount = 0; //0 - 5
	private int housePrice;
	private int[] rents;

	public Street(int number, String name, int price, int housePrice, int[] rents){
		super(number, name, price);
		this.housePrice = housePrice;
		if(rents.length != 6){
			Boundary.showMessage("Invalid number of rents (should be 6)");
			System.exit(0);
		}
		this.rents = rents;
	}
	
	public int getHousePrice(){
		return this.housePrice;
	}
	@Override
	public int getRent() {
		return this.rents[this.houseCount];
	}
	public int getHouseCount() {
		return this.houseCount;
	}
	public void setHouseCount(int houseCount) {
		if(houseCount < 0) houseCount = 0;
		if(houseCount > 5) houseCount = 5;
		this.houseCount = houseCount;
	}

	@Override
	public String toString() {
		String house;
		if(this.houseCount == 5) house = "Hotel";
		else if(this.houseCount == 1) house = "1 house";
		else house = this.houseCount + " houses";
		
		return "Street\t[" + super.toString() + " " + house + "]";
	}
}